const { ccclass, property,executeInEditMode } = cc._decorator;

@ccclass
@executeInEditMode
export default class BezierDraw extends cc.Component {
	@property(cc.Node)
	startNode: cc.Node = null;

	@property(cc.Node)
	c1Node: cc.Node = null;

	@property(cc.Node)
	c2Node: cc.Node = null;

	@property(cc.Node)
	endNode: cc.Node = null;

	// onLoad () {}

	start() {}

	update(dt) {
		let graphics = this.node.getComponent(cc.Graphics);
		graphics.clear();
		graphics.moveTo(this.startNode.x, this.startNode.y);
		graphics.bezierCurveTo(
			this.c1Node.x,
			this.c1Node.y,
			this.c2Node.x,
			this.c2Node.y,
			this.endNode.x,
			this.endNode.y
		);
		graphics.stroke();
	}
}
